package com.yic.module.device.dal.mysql.faulthandle;

import java.util.*;

import com.yic.framework.common.pojo.PageResult;
import com.yic.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yic.framework.mybatis.core.mapper.BaseMapperX;
import com.yic.module.device.dal.dataobject.faulthandle.FaultHandleDO;
import org.apache.ibatis.annotations.Mapper;
import com.yic.module.device.controller.admin.faulthandle.vo.*;

/**
 * 设备报修处理 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface FaultHandleMapper extends BaseMapperX<FaultHandleDO> {

    default PageResult<FaultHandleDO> selectPage(FaultHandlePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FaultHandleDO>()
                .eqIfPresent(FaultHandleDO::getFaultId, reqVO.getFaultId())
                .eqIfPresent(FaultHandleDO::getType, reqVO.getType())
                .eqIfPresent(FaultHandleDO::getGrade, reqVO.getGrade())
                .eqIfPresent(FaultHandleDO::getReason, reqVO.getReason())
                .eqIfPresent(FaultHandleDO::getHandleMethod, reqVO.getHandleMethod())
                .eqIfPresent(FaultHandleDO::getHandleUser, reqVO.getHandleUser())
                .betweenIfPresent(FaultHandleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FaultHandleDO::getId));
    }

    default List<FaultHandleDO> selectList(FaultHandleExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FaultHandleDO>()
                .eqIfPresent(FaultHandleDO::getFaultId, reqVO.getFaultId())
                .eqIfPresent(FaultHandleDO::getType, reqVO.getType())
                .eqIfPresent(FaultHandleDO::getGrade, reqVO.getGrade())
                .eqIfPresent(FaultHandleDO::getReason, reqVO.getReason())
                .eqIfPresent(FaultHandleDO::getHandleMethod, reqVO.getHandleMethod())
                .eqIfPresent(FaultHandleDO::getHandleUser, reqVO.getHandleUser())
                .betweenIfPresent(FaultHandleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FaultHandleDO::getId));
    }

}
